// https://www.luogu.com.cn/problem/P1077

#include<iostream>
using namespace std;

const int N = 110, MOD = 1e6 + 7;
int dp[N][N];
int a[N];
int n, m;

int main()
{
    cin >> n >> m;
    for (int i = 1;i <= n;i++) cin >> a[i];

    dp[0][0] = 1;
    for (int i = 1;i <= n;i++)
        for (int j = m;j >= 0;j--)
            for (int k = 0;k <= j && k <= a[i];k++)
                dp[i][j] = (dp[i][j] + dp[i - 1][j - k]) % MOD;

    cout << dp[n][m] << endl;
    return 0;
}